package com.example.bbbb.funIn;

import java.util.function.Consumer;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-12-15
 * Time: 13:38
 */
// 四大函数式接口
public class Cons {
    public static void main(String[] args) {
        // 消费性接口
//        Consumer<Person> consumer = new Consumer<Person>() {
//            @Override
//            public void accept(Person person) {
//                System.out.println(person.name);
//            }
//        };

        // lambda 表达式
        Consumer<Person> consumer = (person) -> {
            System.out.println(person.name);
        };

        consumer.accept(new Person());
    }
}

class Person {
    String name = "张三";
}